import logging
from redis import StrictRedis


class Config(object):
    SECRET_KEY = "Kn01R/1vAXX1CnpGOvJ1Kf6WX6Wb/m9w4ThJunhsB7rL3wx+E8MFcIcCyUGF/A1bo1PieynBrENaqI5r7rWmSg=="
    SQLALCHEMY_DATABASE_URI = "mysql+pymysql://root:mysql@127.0.0.1:3306/information"
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    REDIS_HOST = "127.0.0.1"
    REDIS_PORT = 6379
    SESSION_TYPE = "redis"
    SESSION_REDIS = StrictRedis(host=REDIS_HOST, port=REDIS_PORT)
    SESSION_USE_SIGNER = True
    SESSION_PERMANENT = False
    PERMANENT_SESSION_LIFETIME = 86400 * 2
    # 开启会将数据库的提交操作自动执行（有缺点）
    SQLALCHEMY_COMMIT_ON_TEADOWN = True

class DevelopConfig(Config):
    DEBUG = True
    LOG_LEVEL = logging.DEBUG


class ProductConfig(Config):
    LOG_LEVEL = logging.ERROR


config = {
    "development": DevelopConfig,
    "production": ProductConfig
}